import 'package:flutter/material.dart';
import './movie/list.dart';

void main() {
  return runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: '电影弄堂',
      theme: ThemeData(primarySwatch: Colors.lightBlue),
      home: DefaultTabController(
        length: 3,
        child: Scaffold(
          appBar: AppBar(
            title: Text(
              '电影弄堂',
              style: TextStyle(fontSize: 18.0, color: Colors.white),
            ),
            centerTitle: true,
            actions: <Widget>[
              Padding(
                padding: EdgeInsets.only(right: 10.0),
                child: IconButton(
                  onPressed: () {
                    print('点击搜索');
                  },
                  icon: Icon(Icons.search),
                ),
              )
            ],
          ),
          drawer: Drawer(
            child: ListView(
              padding: EdgeInsets.all(0.0),
              children: <Widget>[
                UserAccountsDrawerHeader(
                  accountName: Text(
                    '豆芽菜',
                    style: TextStyle(color: Colors.white),
                  ),
                  accountEmail: Text(
                    '1139556759@qq.com',
                    style: TextStyle(color: Colors.white),
                  ),
                  currentAccountPicture: CircleAvatar(
                    backgroundImage: NetworkImage(
                        'https://www.fanhuishou.com/website/logo.png'),
                  ),
                  // 美化当前控件
                  decoration: BoxDecoration(
                      image: DecorationImage(
                          fit: BoxFit.cover,
                          image: NetworkImage(
                              'http://www.liulongbin.top:3005/images/bg1.jpg'))),
                ),
                ListTile(
                  title: Text('用户反馈'),
                  trailing: Icon(Icons.feedback),
                ),
                ListTile(
                  title: Text('系统设置'),
                  trailing: Icon(Icons.settings),
                ),
                ListTile(
                  title: Text('我要发布'),
                  trailing: Icon(Icons.send),
                ),
                Divider(color: Colors.grey),
                ListTile(
                  title: Text('注销'),
                  trailing: Icon(Icons.exit_to_app),
                )
              ],
            ),
          ),
          bottomNavigationBar: Container(
              decoration: BoxDecoration(color: Colors.white10),
              height: 50.0,
              child: TabBar(
                labelStyle: TextStyle(height: 0.0, fontSize: 10.0),
                tabs: <Widget>[
                  Tab(icon: Icon(Icons.movie_filter), text: '正在热映'),
                  Tab(
                    icon: Icon(Icons.movie_creation),
                    text: '即将上映',
                  ),
                  Tab(
                    icon: Icon(Icons.local_movies),
                    text: '本地电影',
                  )
                ],
              )),
          body: TabBarView(
            children: <Widget>[
              MovieList(
                mt: 'in_theaters',
              ),
              MovieList(
                mt: 'coming_soon',
              ),
              MovieList(
                mt: 'top250',
              )
            ],
          ),
          floatingActionButton: new FloatingActionButton(
            onPressed: () {
              print("1111");
            },
            tooltip: 'add',
            child: Icon(Icons.add, size: 20.0),
            foregroundColor: Colors.white,
            backgroundColor: Colors.lightBlue,
          ),
        ),
      ),
    );
  }
}
